package myjava.collections;

import java.util.LinkedList;

public class _LinkedList {

   public static void main(String[] args) {

      /* veloce nelle inserzioni
          lento nelle iterazioni */

      LinkedList<String> o = new LinkedList<String>();

      o.add(0, "1");
      o.add("2");
      o.add("3");
      o.add("4");
      o.add("5");

      System.out.println(o.toString());
 
      o.add(4, "4.5");
      System.out.println(o.toString());

      for (String s : o) {
         System.out.println(o.indexOf(s) + " : " + s);
      }
   }
}